﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	
  <head>
    <title>岗位切换</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8"/>
    <%@include file="../../include/include.jsp"%>
	<link rel="stylesheet" type="text/css" href="${webcontext}/css/public.css"/>
	<link rel="stylesheet" type="text/css" href="${webcontext}/css/datepicker.css"/>
	<link rel="stylesheet" type="text/css" href="${webcontext}/css/style_l.css"/>
	<link rel="stylesheet" type="text/css" href="${webcontext}/css/jquery.alerts.css" />
	<script type="text/javascript" src="${jspath}/jquery/jquery-1.4.4.js"></script>
	<script type="text/javascript" src="${jspath}/jquery/jquery.blockUI.js"></script>
    <script type="text/javascript" src="${jspath}/jquery/jquery.selectAll.js"></script>
    <script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
    <script type="text/javascript" src="${jspath}/load_layer.js"></script>
    <link rel="stylesheet" type="text/css" href="${webcontext}/css/validationEngine.jquery.css" />
    <script type="text/javascript" src="${jspath}/jquery/validate/jquery.validationEngine.js"></script>
    <script type="text/javascript" src="${jspath}/jquery/validate/jquery.validationEngine-zh.js"></script>
    <script type="text/javascript">
		$(function() {
			
			$("#confirm_select").click(function(){
				if($(":radio:checked").val()==undefined){
					jAlert("请选择要切换的岗位！","提示信息");
			    	return;
				}
				
				$.get("${webcontext}/dm/userperm/switchGroup?groupId="+$(":radio:checked").val()+"&timestamp="+ Date.parse(new Date()),
						{},
						function(msg){
							parent.$("#userGroupName").text($(":radio:checked").parent().siblings("td").eq(1).text()+": ");
							jAlert("岗位切换成功！","提示",function(){
								removeLayer();
							});
						}
				);
			});
			
			
			$(":radio").each(function(){
				if($(this).val() == ${currentGroup.id}){
					$(this).attr("checked","checked");
				}
			});
			
			$("#cancel_select").click(function() {
				removeLayer();
			});
		});
	</script>  
  </head>

  <body>
	
	<!-- content -->
	<div id="content">
		<!-- wrap 
		<form id="selectForm" action="${webcontext}/dm/sgm/maintain/createEmployee" method="post" >
		-->
		<div id="wrap">
		<!-- block_div : default-hidden -->
			<div class="block_div" style="display:block;" id="add_zz_block">
				<div class="title">
					<span>岗位切换</span>
				</div>
				<div class="spliter h_5"></div>
                 <div class="data_div">
                        <table id="groupTable" class="data_tab">
                            <tr>                      
                                <th>选择</th><th>岗位代码</th><th>岗位名称</th>
                            </tr>
                            
                            <core:forEach items="${userGroupsDto}" var="userGroup"> 
                            <tr>
                                <td class='center'>
				                <input type='radio' value= "${userGroup.id}" name= "groupIdRad" class="validate[required]"/>
				                </td>
				                <td>${userGroup.userGroupCode}</td>
				                <td>${userGroup.userGroupName}</td>
				            </tr> 
							</core:forEach>
							
                        </table>
                    </div>
                <div class="spliter h_5"></div>                
                <div class="btn_div">
                    <input type="button" class="btn" value="确定" id="confirm_select"/>
                    <input type="button" class="btn" value="返回" id="cancel_select"/>
                </div>
                    
			</div>
			<!-- /block_div -->
		</div>
		<!-- </form> -->
		<!-- /wrap -->
	</div>
	<!-- /content -->

  </body>
</html>
